package rexsee.baidu;

import rexsee.core.browser.Browser;
import rexsee.core.browser.clazz.JavascriptInterface;
import android.content.Context;

import com.baidu.mobstat.StatService;

public class RexseeBaiduStatistic implements JavascriptInterface {

	public static final String INTERFACE_NAME = "BaiduStatistic";
	@Override
	public String getInterfaceName() {
		return mBrowser.application.resources.prefix + INTERFACE_NAME;
	}
	@Override
	public JavascriptInterface getInheritInterface(Browser childBrowser) {
		return this;
	}
	@Override
	public JavascriptInterface getNewInterface(Browser childBrowser) {
		return new RexseeBaiduStatistic(childBrowser);
	}

	private final Context mContext;
	private final Browser mBrowser;

	public RexseeBaiduStatistic(Browser browser) {
		mBrowser = browser;
		mContext = browser.getContext();
	}

	public void onEvent(String event_id, String label) {
		StatService.onEvent(mContext, event_id, label);
	}
	public void onEvent(String event_id, String label, int acc) {
		StatService.onEvent(mContext, event_id, label, acc);
	}

}
